package com.autoTools.view;

import java.awt.Component;
import java.awt.Menu;
import java.awt.Menu;
import java.awt.MenuItem;

import com.autoTools.util.Constants;
import com.autoTools.util.LogUtil;

public class MenuView extends BaseView
{
	final static String TAG = "MenuView";
	private Menu mMenu = null;

	public MenuView()
	{
		mMenu = new Menu();
		BaseInit(mMenu);
	}

	public boolean addChild(BaseView child)
	{
		boolean state = false;
		if (child != null)
		{
			if (child.getParent() != null)
			{
				state = false;
			}else{
				if(child.getInstance() instanceof MenuItem){
					mMenu.add((MenuItem) child.getInstance());
					state = super.addChild(child);
				}else{
					LogUtil.sysLog(TAG, "addChild Error:child is not extends MenuItem");
				}
			}
		}
		return state;
	}
	
	public void setLabel(String label){
		super.setLabel(label);
		mMenu.setLabel(label);
	}
}
